import java.util.Scanner;

public class ArrayDemo1 {
    /*
    *public static void main(String[] args){
        System.out.println("Hello world....");
      boolean flag = true;
        int max = 0;
        int min = 1;
        int time = 0;

        while(flag){
            Scanner in =new Scanner(System.in);
            int a=in.nextInt();
            System.out.println(a);
            //
            if (a == 0){
                break;
            }

            if(a>max){
                max = a;
            }

            if(time==0){
                min = a;
            }else if(min > a){
                min = a;
            }
            time++;
        }
        System.out.println("max="+max);
        System.out.println("min="+min);
    }
    * */
    public static void main(String[] args) {
        //定义并初始化数组
        int[] nums = new int[]{1, 2, 3, 4, 5, 0, 7};
        System.out.println("数组长度=" + nums.length);
        //重新初始化数组
//        nums = new int[]{2, 4, 8};
//        System.out.println("数组长度=" + nums.length);

        int j =0;
        for(int i = 0; i<=2 ;i++){
            if(i==0){
                for(int a = 0;a<nums.length;a++){
                    if(nums[a] != 0 ){
                        j++;
                        System.out.println(nums[a]);
                    }
                }
                System.out.println("j==00000==="+j);
            }
            if(i==1){
                System.out.println("j==1111==="+j);
                int[] num1 = new int[j-1];
                for(int a = 0;a<nums.length;a++){
                    if(nums[a] != 0 ){
                        System.out.println(nums[a]);
                        for(int b =0; b<j; b++){
                        num1[b] = nums[a];
                        }
                    }
                    }

            }

        }

    }
}

